//
//  MODepthDoDetail_Text_MainViewController.m
//  MobileOffice
//
//  Created by 冰冰 on 2019/6/26.
//  Copyright © 2019 com.idolmedia. All rights reserved.
//

#import "MODepthDoDetail_Text_MainViewController.h"

@interface MODepthDoDetail_Text_MainViewController ()

@property(nonatomic,strong)UIScrollView *scrollView;

@property(nonatomic,strong)UILabel *titleLabel;

@property(nonatomic,strong)UILabel *peopleLabel;

@property(nonatomic,strong)UILabel *dateLabel;

@property(nonatomic,strong)UIView *lineViewO;

@property(nonatomic,strong)UIView *lineView;

@property(nonatomic,strong)UILabel *contentLabel;

@property(nonatomic,strong)NSString *contentStr;

@property(nonatomic,strong)NSString *ngrStr;

@end

@implementation MODepthDoDetail_Text_MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.view addSubview:self.scrollView];
    
    [self.scrollView addSubview:self.lineViewO];
    
    [self.scrollView addSubview:self.titleLabel];
    
    [self.scrollView addSubview:self.peopleLabel];
    
    [self.scrollView addSubview:self.dateLabel];
    
    [self.scrollView addSubview:self.lineView];
    
    [self.scrollView addSubview:self.contentLabel];
    
    _titleStr = self.waitModel.nameStr;
    _dateStr = self.waitModel.dateStr;
    _contentStr = self.waitModel.content;
    [self againSetFrame];
}


-(void)setWaitAgainModel:(MONoticeModel *)waitAgainModel
{
    _waitModel = waitAgainModel;
    _titleStr = self.waitModel.nameStr;
    _dateStr = self.waitModel.dateStr;
    _contentStr = self.waitModel.content;
    _ngrStr = self.waitModel.ngr;
    [self againSetFrame];
}

-(void)againSetFrame
{
    self.titleLabel.text = self.titleStr;
    CGFloat height = [NSString labelAutoCalculateRectWith:self.titleStr WithFont:[UIFont boldSystemFontOfSize:22] MaxSize:CGSizeMake(SCREEN_WIDTH - kWConversions(15)*2, MAXFLOAT)].height;
    self.titleLabel.height = height;
    
    if (self.ngrStr.length>0) {
        self.peopleLabel.y = self.titleLabel.bottom + kWConversions(15);
        self.peopleLabel.height = 16;
        self.peopleLabel.text = [NSString stringWithFormat:@"拟稿人:%@",self.ngrStr];
    }else{
        self.peopleLabel.height = 0.00001;
    }
    
    self.dateLabel.text = self.dateStr;
    CGFloat height1 = [NSString labelAutoCalculateRectWith:self.dateStr WithFont:FONT_SIZE(11) MaxSize:CGSizeMake(SCREEN_WIDTH - kWConversions(15)*2, MAXFLOAT)].height;
    self.dateLabel.y = _peopleLabel.bottom + kWConversions(15);
    self.dateLabel.height = height1;
    
    self.lineView.y = _dateLabel.bottom + kWConversions(15);
    
    
    CGSize size = [NSString labelAutoCalculateRectWith:self.contentStr WithFont:FONT_SIZE(17) MaxSize:CGSizeMake(SCREEN_WIDTH - kWConversions(15)*2, MAXFLOAT)];
    self.contentLabel.text = self.contentStr;
    self.contentLabel.height = size.height;
    self.contentLabel.y = _lineView.bottom + kWConversions(21);
    
    self.scrollView.contentSize = CGSizeMake(SCREEN_WIDTH, self.contentLabel.bottom + 30);
}


-(UIScrollView *)scrollView
{
    if (!_scrollView) {
        _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - StatusBarAndNavigationBarHeight - 41)];
        _scrollView.backgroundColor = [UIColor whiteColor];
        _scrollView.showsHorizontalScrollIndicator = NO;
        _scrollView.showsVerticalScrollIndicator = NO;
    }
    return _scrollView;
}

-(UIView *)lineViewO
{
    if (!_lineViewO) {
        _lineViewO = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 10)];
        _lineViewO.backgroundColor = KGrayColor_ededed;
    }
    return _lineViewO;
}

-(UILabel *)titleLabel
{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(kWConversions(15), _lineViewO.bottom + kWConversions(24), SCREEN_WIDTH - kWConversions(15)*2, 1)];
        _titleLabel.textColor = KBlackColor_222222;
        _titleLabel.font = [UIFont boldSystemFontOfSize:22];
        _titleLabel.numberOfLines = 0;
    }
    return _titleLabel;
}

-(UILabel *)peopleLabel
{
    if (!_peopleLabel) {
        _peopleLabel = [[UILabel alloc]initWithFrame:CGRectMake(kWConversions(15), _titleLabel.bottom + kWConversions(15), SCREEN_WIDTH - kWConversions(15)*2, 1)];
        _peopleLabel.textColor = KBlackColor_222222;
        _peopleLabel.font = FONT_SIZE(15);
        _peopleLabel.numberOfLines = 0;
    }
    return _peopleLabel;
}


-(UILabel *)dateLabel
{
    if (!_dateLabel) {
        _dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(kWConversions(15), _peopleLabel.bottom + kWConversions(15), SCREEN_WIDTH - kWConversions(15)*2, 1)];
        _dateLabel.textColor = KBlackColor_919395;
        _dateLabel.font = FONT_SIZE(11);
    }
    return _dateLabel;
}

-(UIView *)lineView
{
    if (!_lineView) {
        _lineView = [[UIView alloc]initWithFrame:CGRectMake(0, _dateLabel.bottom + kWConversions(15), SCREEN_WIDTH, 1)];
        _lineView.backgroundColor = KGrayColor_ededed;
    }
    return _lineView;
}


-(UILabel *)contentLabel
{
    if (!_contentLabel) {
        _contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(kWConversions(15), _lineView.bottom + kWConversions(21), SCREEN_WIDTH - kWConversions(15)*2, 1)];
        _contentLabel.textColor = KBlackColor_3c3c3c;
        _contentLabel.font = FONT_SIZE(17);
        _contentLabel.numberOfLines = 0;
    }
    return _contentLabel;
}





@end
